package com.kld.data.domain.po;

import com.kld.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.pentaho.di.core.database.DatabaseMeta;

/**
 * 数据连接对象 sys_druid
 *
 * @author ruoyi
 * @date 2020-12-02
 */
@Data
public class SysDruid extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 数据源ID */
    private String id;

    /** 连接名称 */
    private String name;

    /** 连接类型 */
    private String type;

    /** 连接方式 */
    private String access;

    /** 主机名或ip */
    private String host;

    /** 数据库名称及连接属性 */
    private String db;

    /** 数据库端口 */
    private String port;

    /** 数据库用户名 */
    private String userName;

    /** 数据库密码 */
    private String passWord;

    /** 备注 */
    private String remark;

    public void setId(String id)
    {
        this.id = id;
    }

    public String getId()
    {
        return id;
    }
    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }
    public void setType(String type)
    {
        this.type = type;
    }

    public String getType()
    {
        return type;
    }
    public void setAccess(String access)
    {
        this.access = access;
    }

    public String getAccess()
    {
        return access;
    }
    public void setHost(String host)
    {
        this.host = host;
    }

    public String getHost()
    {
        return host;
    }
    public void setDb(String db)
    {
        this.db = db;
    }

    public String getDb()
    {
        return db;
    }
    public void setPort(String port)
    {
        this.port = port;
    }

    public String getPort()
    {
        return port;
    }
    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    public String getUserName()
    {
        return userName;
    }
    public void setPassWord(String passWord)
    {
        this.passWord = passWord;
    }

    public String getPassWord()
    {
        return passWord;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("name", getName())
            .append("type", getType())
            .append("access", getAccess())
            .append("host", getHost())
            .append("db", getDb())
            .append("port", getPort())
            .append("userName", getUserName())
            .append("passWord", getPassWord())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }

    public DatabaseMeta initDatabaseMeta() {
        DatabaseMeta databaseMeta = new DatabaseMeta(getName(), getType(), getAccess(), getHost(), getDb(), getPort(), getUserName(), getPassWord());
        return databaseMeta;
    }
}
